<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .active{
            border: 1px solid red;
            width: 100px;
            height: 100px;
        }
        .error{
            background-color: orange;
        }
        [v-cloak] {
            display: none;
        }
    </style>
</head>
<body>
    <h2>Vue循环结构</h2>
        <div id="app">
           <div>水果列表</div>
           <ul>
               <li v-for='item in fruits'>{{item}}</li><br>
               <li v-for='(item,index) in fruits'>{{item+'------'+index}}</li><br>
               <li v-for='(item,index) in myFruits' :key='item.id'>
                   <span>{{item.ename}}</span>
                   <span>{{item.cname}}</span>
               </li>
           </ul>
        </div>
</body>
<script src="./js/vue.js"></script>
<script>
    /*
        总结：
            1、分支结构
                        v-for   遍历数组
    */
    var vm = new Vue({
        el: '#app',
        data: {
           fruits: ['apple','orange','banana'],
           myFruits: [{
               id: 1,
               ename: 'apple',
               cname: '苹果'
           },{
               id: 2,
               ename: 'orange',
               cname: '橘子'
           },{
               id: 3,
               ename: 'banana',
               cname: '香蕉'
           }]
        },
        methods:{
            handle:function(){
                //控制 样式的切换
                this.flag = !this.flag 
            }
        }
    })
</script>
</html>